package com.zzedu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzedu.common.utils.StringUtils;
import com.zzedu.domain.ZzWordBody;
import com.zzedu.dto.ZzWordBodyDTO;
import com.zzedu.mapper.ZzWordBodyMapper;
import com.zzedu.service.IZzWordBodyService;
import org.springframework.stereotype.Service;

/**
 * (教育-统计)文件内容Service业务层处理
 *
 * @author Mr.Wang
 * @date 2025-03-16
 */
@Service
public class ZzWordBodyServiceImpl extends ServiceImpl<ZzWordBodyMapper, ZzWordBody> implements IZzWordBodyService {

    @Override
    public LambdaQueryWrapper<ZzWordBody> buildQuery(ZzWordBodyDTO zzWordBody) {
        LambdaQueryWrapper<ZzWordBody> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(null != zzWordBody.getFileId(), ZzWordBody::getFileId, zzWordBody.getFileId());
        lambdaQueryWrapper.eq(null != zzWordBody.getWordCount(), ZzWordBody::getWordCount, zzWordBody.getWordCount());
        lambdaQueryWrapper.like(StringUtils.isNotBlank(zzWordBody.getWordContent()), ZzWordBody::getWordContent, zzWordBody.getWordContent());
        lambdaQueryWrapper.exists("select file_id from zz_word_head where  zz_word_head.deleted=0 and file_id=zz_word_head.id");
        return lambdaQueryWrapper;
    }

}